<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 
    


<ui:composition template="/WEB-INF/layout/template.xhtml">
	<ui:define name="conteudo">
	<h:form class="form-horisontal">
	<legend> Check-List </legend>
	<div class="alert alert-error">
		<h:messages globalOnly="true"/>
	</div>
	
	
	<div class="row-fluid">
		<div class="span4">
			<h:outputLabel value="Data" for="data" />
			<h:inputText value="#{checklistBean.checklist.data}"  id="data" disabled="true" >
				<f:convertDateTime pattern="M/d/yy hh:mm"/>
			</h:inputText>
		</div>
		
		<div class="span4">
			<h:outputLabel value="Unidade" for="unidade" />
			<h:selectOneMenu value="#{checklistBean.checklist.unidade}" id="unidade" required="true" >
				
				<f:selectItems  value="#{unidadeBean.unidades}" var="unidade"
				itemValue="#{unidade}" itemLabel="#{unidade.descricao}"/>
			</h:selectOneMenu>
		</div>
	</div>
	
	<div class="row-fluid">
		<div class="span4">
			<h:outputLabel value="Possui Internet ?" for="internet" />
			<h:selectBooleanCheckbox value="#{checklistBean.checklist.internet}" id="internet" required="true" />
		</div>
		
		<div class="span4">
			<h:outputLabel value="Possui Rede ?" for="rede" />
			<h:selectBooleanCheckbox value="#{checklistBean.checklist.rede}" id="rede" />
		</div>
		
		<div class="span4">
			<h:outputLabel value="Possui eletrica" for="eletrica" />
			<h:selectBooleanCheckbox value="#{checklistBean.checklist.internet}" id="eletrica" />
		</div>
	</div>	
	<br />
		<div class="row-fluid">
			<div class="span12">
				<h:commandButton action="#{checklistBean.salvar()}" value="Salvar" class="btn  btn-primary" />
			</div>
		</div>
	</h:form>
	
	<h:dataTable value="#{checklistBean.checklist.equipamentos}" var="e" id="tb_equipamentos" class="table">
	
	<h:column>
		<f:facet name="header"> Unidade</f:facet>
		#{e.unidade.descricao}
	</h:column>
	
	<h:column>
		<f:facet name="header"> Nome/Tombo</f:facet>
		#{e.tombamento}
	</h:column>
	
	<h:column>
		<f:facet name="header"> Descricao </f:facet>
		#{e.modelo}
	</h:column>
	
	<h:column>
		<f:facet name="header"> Localização </f:facet>
		#{e.localizacao}
	</h:column>
		
		
	</h:dataTable>
	
		
	</ui:define>
</ui:composition>
</html>